// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Person.cs" company="XamlmNinja">
//   2010
// </copyright>
// <summary>
//   The person.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace ServiceStyleRatherThanMessengerStyle.Model
{
    using System;
    using Serialization;

    /// <summary>
    /// The person.
    /// </summary>
    [Serializer(typeof(Person))]
    public class Person : ISerializeObject
    {
        #region Properties

        /// <summary>
        /// Gets or sets FirstName.
        /// </summary>
        public string FirstName { get; set; }

        /// <summary>
        /// Gets or sets LastName.
        /// </summary>
        public string LastName { get; set; }

        /// <summary>
        /// Gets or sets ProfileImage.
        /// </summary>
        public string ProfileImage { get; set; }

        #endregion

        public object[] Serialize(object target)
        {
            var person = (Person)target;
            return new object[] { person.FirstName,
                                  person.LastName,
                                  person.ProfileImage };
        }

        public object Deserialize(object[] data)
        {
            var person = new Person
            {
                FirstName = (string)data[0],
                LastName = (string)data[1],
                ProfileImage = (string)data[2]
            };

            return person;
        }
    }
}